import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import confirm from '@dfeidao/atom-web/msgbox/confirm';
import error from '@dfeidao/atom-web/msgbox/error';
import success from '@dfeidao/atom-web/msgbox/success';
import a003 from './a003';

export default async function a011(fd: IFeidaoAiBrowserComponent, args: { target: HTMLSpanElement }) {
	// 禁用
	const node = args.target;
	const tenantid = node.getAttribute('data-tenantid');

	const con = await confirm('确认停用？', '提示', '确定', '取消', 'rgba(153, 153, 153, 1)');

	if (con === 'yes') {

		const productid = get(fd, 'productid');
		const res = await nodejs('tenant-inf/zj-000001/s003', { filter: { tenantid, productid } });
		if (res === 'success') {
			success('停用成功!');
			await a003(fd);
		} else {
			error('停用失败!');
		}
	}


}
